home *** CD-ROM | disk | FTP | other *** search
- /*==============================================================================
- Project: POV
-
- Version: 3
-
- File: PrePost.c
-
- Description:
- Routines called back out from inside the engine during its processing.
- ------------------------------------------------------------------------------
- Author:
- Eduard [esp] Schwan
- ------------------------------------------------------------------------------
- from Persistence of Vision(tm) Ray Tracer
- Copyright 1996 Persistence of Vision Team
- ------------------------------------------------------------------------------
- NOTICE: This source code file is provided so that users may experiment
- with enhancements to POV-Ray and to port the software to platforms other
- than those supported by the POV-Ray Team. There are strict rules under
- which you are permitted to use this file. The rules are in the file
- named POVLEGAL.DOC which should be distributed with this file. If
- POVLEGAL.DOC is not available or for more info please contact the POV-Ray
- Team Coordinator by leaving a message in CompuServe's Graphics Developer's
- Forum. The latest version of POV-Ray may be found there as well.
-
- This program is based on the popular DKB raytracer version 2.12.
- DKBTrace was originally written by David K. Buck.
- DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
- ------------------------------------------------------------------------------
- Change History:
- 960428 [esp] Created
- 960422 [esp] Added POVRAY.INI processing
- ==============================================================================*/
-
-
- #define PREPOST_C
-
- #include "PrePost.H"
-
- /*==== POV-Ray std headers ====*/
- #include "config.h"
- #include "povray.h" // SHELLTYPE
- #include "optin.h" // parse_ini_file
- // #include "AppPrefs.h" // slc added, missing type
-
- /*==== Standard C headers ====*/
- #include <stdlib.h>
-
-
- // ---------------------------------------------------------------------
- int Mac_Shellout(int shellType)
- {
- int rCode;
-
- switch(shellType) // SHELLTYPE
- {
- case PRE_SCENE_SHL: // "pre-scene"
- break;
- case PRE_FRAME_SHL: // "pre-frame"
- break;
- case POST_FRAME_SHL: // "post-frame"
- break;
- case POST_SCENE_SHL: // "post-scene"
- break;
- case USER_ABORT_SHL: // "user about"
- break;
- case FATAL_SHL: // "fatal error"
- break;
- }
-
- // printf("### pov_mac_shellout called --> '%d'\n", s_type);
-
- rCode=Mac_SystemCall("-!-");
-
- return rCode;
- }
-
-
- // ---------------------------------------------------------------------
- int Mac_SystemCall(char * cmdstr)
- {
- #pragma unused(cmdstr)
- /*( typedef SHELLRET )
- IGNORE_RET = 0,
- QUIT_RET,
- USER_RET,
- FATAL_RET,
- SKIP_ONCE_RET,
- ALL_SKIP_RET
- */
- // printf("### Doing Mac shell command --> '%s'\n", cmdstr);
- return IGNORE_RET;
- }
-
-
- // ---------------------------------------------------------------------
- // see if file exists in current/default folder
- int File_Exists(char * fileName)
- {
- int retVal;
- FILE *f;
-
- // The simplest (but slow) way to tell if a file exists is to try to open it
- f = fopen(fileName, "r");
- if (f)
- {
- fclose(f); // didn't really want to open, sorry, never mind, bye.
- retVal = true; // exists
- }
- else
- retVal = false; // doesn't exist
- return retVal;
- }
-
-
-
- // ---------------------------------------------------------------------
- // Get default POVRAY.INI filename from resource (not READ_ENV_VAR), and
- // pass it on to engine to read if it exists.
- void Mac_Process_Povray_Ini(void)
- {
- OSErr anError = noErr;
- short saveVRefNum;
- long saveDirID;
- Str255 iniFileName;
-
- // read it from the STR# resource
- GetIndString(iniFileName, kSTRI_FileNames, kSTRIi_POVRAY_INI);
- anError = ResError();
-
- if (!anError)
- {
- // remember current folder, since we're about to change it
- anError = HGetVol((StringPtr)NULL, &saveVRefNum, &saveDirID);
-
- // now look for "POVRAY.INI" in the application directory
- SetCurrentDirToAppDir();
-
- if (!anError)
- {
- // convert it to a C string
- p2cstr(iniFileName);
- // now call the file parser to handle it
- parse_ini_file((char*)iniFileName);
- }
-
- // reset current folder
- anError = HSetVol((StringPtr)NULL, saveVRefNum, saveDirID);
- }
- }
-
-
- // ---------------------------------------------------------------------
- void Mac_PreRender(void)
- {
- }
-
-
- // ---------------------------------------------------------------------
- void Mac_PreShutdown(void)
- {
- }
-
-
- // ---------------------------------------------------------------------
- void Mac_PostShutdown(void)
- {
- }
-
-